<?php

/**
 * TournamentCategories form base class.
 *
 * @method TournamentCategories getObject() Returns the current form's model object
 *
 * @package    makethetouch
 * @subpackage form
 * @author     Sebastien Chassande-Barrioz
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseTournamentCategoriesForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'tournament'      => new sfWidgetFormInputHidden(),
      'category'        => new sfWidgetFormInputHidden(),
      'max_team'        => new sfWidgetFormInputText(),
      'nb_engaged_team' => new sfWidgetFormInputText(),
      'dead_line'       => new sfWidgetFormDate(),
    ));

    $this->setValidators(array(
      'tournament'      => new sfValidatorChoice(array('choices' => array($this->getObject()->get('tournament')), 'empty_value' => $this->getObject()->get('tournament'), 'required' => false)),
      'category'        => new sfValidatorChoice(array('choices' => array($this->getObject()->get('category')), 'empty_value' => $this->getObject()->get('category'), 'required' => false)),
      'max_team'        => new sfValidatorInteger(),
      'nb_engaged_team' => new sfValidatorInteger(),
      'dead_line'       => new sfValidatorDate(),
    ));

    $this->widgetSchema->setNameFormat('tournament_categories[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'TournamentCategories';
  }

}
